<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>自定义表单详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/systemStatic/style/admin.css">
    <link rel="stylesheet" href="${ctx}/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/css/public.css">
</head>
<body>
<form class="layui-form formDef"  lay-filter="formData" style="height: 100%;background: #fff;">
    <div class="layui-btn-container" style="position: absolute;bottom: 0;left: 47%;">
        <button class="layui-btn layui-btn-danger" id="return">关闭</button>
    </div>
    <div class="detal" style="padding-top:10px;">
        <div class="layui-form-item">
            <label class="layui-form-label">表单名: </label>
            <div class="layui-input-inline">
                <input type="text" name="subject" value="${formDef.subject}" class="layui-input" autocomplete="off" readonly
                       lay-verify="formTitle" />
            </div>
            <label class="layui-form-label">备注: </label>
            <div class="layui-input-inline">
                <input type="text" name="formDesc" value="${formDef.formDesc}" class="layui-input" autocomplete="off" readonly />
            </div>
            <label class="layui-form-label">默认版本: </label>
            <div class="layui-input-inline">
                <input type="text" name="formTitle" value="默认" class="layui-input" autocomplete="off" readonly />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">发布状态: </label>
            <div class="layui-input-inline">
                <input type="text" id="isPublished" name="isPublished" class="layui-input" autocomplete="off" readonly />
            </div>
            <label class="layui-form-label" id="personLabel">发布人: </label>
            <div class="layui-input-inline">
                <input type="text" name="publishedBy"  id="publishedBy"  value="${formDef.publishedBy}" class="layui-input" autocomplete="off" readonly />
            </div>
            <label class="layui-form-label" id="timeLabel">发布时间: </label>
            <div class="layui-input-inline">
                <input type="text" name="publishTime" id="publishTime" value="${formDef.title}" class="layui-input" autocomplete="off" readonly />
            </div>
        </div>
        <div class="layui-form-item" style="padding-right:30px;">
            <label class="layui-form-label">表单HTML: </label>
            <pre class="layui-code" style="height: 325px;overflow-y: auto;" >
            <div id="formDefHtml">

            </div>
      </pre>
        </div>
    </div>

</form>
<script type="text/javascript">
    var __ctx = "${ctx}";
</script>
<script src="${ctx}/public/component.js" type="text/javascript"></script>
<script src="${ctx}/layui/layui.js"></script>
<script>
    layui.config({
        base: serverPath.formPath + staticPath.formPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','table', 'form', 'jquery','setter','code'], function () {
        var $ = layui.$;
        var index = parent.layer.getFrameIndex(window.name);
        $('#return').click(function () {
            parent.layer.close(index);
        });
        layui.code();
        var isPublished = '${formDef.isPublished}';
        var isDefault = '${formDef.isDefault}';
        if(isPublished==1){
            $("input[name='isPublished']").val('已发布');
        }else{
            $("input[name='isPublished']").val('未发布');
            $("#personLabel").text("创建人");
            $("#timeLabel").text("创建时间");
            $("#publishedBy").val('${formDef.creator}');
        }
        if(isDefault==1){
            $("input[name='formTitle']").val('默认');
        }else{
            $("input[name='formTitle']").val('非默认');
        }
        var html=  decodeURI(decodeURIComponent('${formDef.html}'));
        $("#formDefHtml").text(html);
    });
</script>
</body>
</html>